import 'package:flutter/material.dart';
import 'package:flutter02/my_icon_font.dart';

void main() {
  runApp(MaterialApp(
    theme: ThemeData(primarySwatch: Colors.red),
    home: Scaffold(
      appBar: AppBar(
        title: const Text(
          '你好，Flutter',
          style: TextStyle(color: Colors.white),
        ),
        backgroundColor: Colors.red,
      ),
      body: ListView(
        children: const [
          Icon(Icons.confirmation_num_sharp),
          Icon(
            Icons.ac_unit,
            color: Colors.red,
            size: 100,
          ),
          Icon(
            Icons.home,
            color: Colors.green,
            size: 200,
          ),
          Icon(
            Icons.settings,
            size: 300,
            color: Colors.blue,
          ),
          Icon(
            MyIconFont.cangkucangchu,
            color: Colors.red,
          )
        ],
      ),
    ),
  ));
}

class LocalImage extends StatelessWidget {
  const LocalImage({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 150,
      width: 150,
      decoration: BoxDecoration(
          color: Colors.red, border: Border.all(width: 2, color: Colors.red)),
      child: Image.asset(
        "images/a.png",
        fit: BoxFit.cover,
      ),
    );
  }
}

class ClipOvalImage extends StatelessWidget {
  const ClipOvalImage({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: ClipOval(
        child: Image.network(
          "https://fs.aihujiankang.com/8750a88ccd6bddb3d1325bd656b59c7f4b8ed5aaed5501d1e6b9f495fb45c7d5.jpg",
          width: 150,
          height: 150,
          fit: BoxFit.cover,
        ),
      ),
    );
  }
}

/// 实现一个圆形图片
class CircularImage extends StatelessWidget {
  const CircularImage({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 150,
      height: 150,
      decoration: BoxDecoration(
          color: Colors.yellow,
          borderRadius: BorderRadius.circular(75),
          image: const DecorationImage(
              image: NetworkImage(
                  "https://fs.aihujiankang.com/8750a88ccd6bddb3d1325bd656b59c7f4b8ed5aaed5501d1e6b9f495fb45c7d5.jpg"),
              fit: BoxFit.cover)),
    );
  }
}

class MyImage extends StatelessWidget {
  const MyImage({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        width: 150,
        height: 150,
        // alignment: Alignment.centerLeft,
        decoration: const BoxDecoration(color: Colors.yellow),
        child: Image.network(
          "https://fs.aihujiankang.com/8750a88ccd6bddb3d1325bd656b59c7f4b8ed5aaed5501d1e6b9f495fb45c7d5.jpg",
          // scale: 3,
          // alignment: Alignment.centerLeft,
          // fit: BoxFit.cover,
          // repeat: ImageRepeat.repeat,
        ),
      ),
    );
  }
}

class MyText extends StatelessWidget {
  const MyText({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 200,
      height: 200,
      margin: const EdgeInsets.fromLTRB(0, 40, 0, 0),
      decoration: const BoxDecoration(color: Colors.yellow),
      child: const Text(
        "你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter你好，我是FLutter",
        textAlign: TextAlign.center,
        maxLines: 1,
        overflow: TextOverflow.ellipsis,
        style: TextStyle(
            fontSize: 20,
            color: Colors.red,
            fontWeight: FontWeight.w900,
            fontStyle: FontStyle.italic,
            letterSpacing: 5,
            decoration: TextDecoration.underline,
            decorationColor: Colors.green,
            decorationStyle: TextDecorationStyle.dashed),
      ),
    );
  }
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        alignment: Alignment.center,
        // 配置容器内
        width: 300,
        height: 300,
        margin: const EdgeInsets.fromLTRB(0, 60, 0, 0),
        // transform: Matrix4.translationValues(-40, 30, 0), // 位移
        // transform: Matrix4.rotationZ(19), // 旋转
        transform: Matrix4.skewY(.2),
        decoration: BoxDecoration(
            color: Colors.red,
            // 背景颜色
            border: Border.all(color: Colors.green, width: 2),
            borderRadius: BorderRadius.circular(300),
            boxShadow: const [BoxShadow(color: Colors.blue, blurRadius: 20)],
            gradient: const SweepGradient(
                colors: [Colors.yellow, Colors.blueAccent])),
        child: const Text('Hello flutter',
            style: TextStyle(color: Colors.white, fontSize: 40)),
      ),
    );
  }
}

class MyButton extends StatelessWidget {
  const MyButton({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.center,
      width: 200,
      height: 40,
      // margin: const EdgeInsets.all(10), // 四周
      margin: const EdgeInsets.fromLTRB(0, 40, 0, 0),
      // padding: const EdgeInsets.fromLTRB(40, 0, 0, 0),
      decoration: BoxDecoration(
          color: Colors.blue, borderRadius: BorderRadius.circular(20)),
      child: const Text(
        "按钮",
        style: TextStyle(color: Colors.white, fontSize: 20),
      ),
    );
  }
}
